package com.ruoyi.weixin.shop.controller;

import com.ruoyi.weixin.shop.domain.YxUserExtract;
import com.ruoyi.weixin.shop.dto.YxUserExtractQueryCriteria;
import com.ruoyi.weixin.shop.service.YxUserExtractService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * @author hupeng
 * @date 2019-11-14
 */
@Api(tags = "商城:提现管理")
@RestController
@RequestMapping("api")
public class UserExtractController {

    private final YxUserExtractService yxUserExtractService;

    public UserExtractController(YxUserExtractService yxUserExtractService) {
        this.yxUserExtractService = yxUserExtractService;
    }

    @ApiOperation(value = "查询")
    @GetMapping(value = "/yxUserExtract")
	@PreAuthorize("@ss.hasPermi('shop:userExtract:list')")
    public ResponseEntity getYxUserExtracts(YxUserExtractQueryCriteria criteria, Pageable pageable) {
        return new ResponseEntity(yxUserExtractService.queryAll(criteria, pageable), HttpStatus.OK);
    }


    @ApiOperation(value = "操作提现")
    @PutMapping(value = "/yxUserExtract")
	@PreAuthorize("@ss.hasPermi('shop:userExtract:edit')")
    public ResponseEntity update(@Validated @RequestBody YxUserExtract resources) {
        yxUserExtractService.doExtract(resources);
        return new ResponseEntity(HttpStatus.NO_CONTENT);
    }

}
